/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.fyx.core.itext;

import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Font;
import com.itextpdf.text.pdf.BaseFont;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Trida ktera zodpovida za spravne vraceni standardniho nastaveni
 * pisma pro generovani pdf dokumentu prostrednictvim iText.
 * 
 * @author xljan
 */
public class ItextStandard {

    public static final String BASE_FONT_PATCH = "/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-L.ttf";
    public static final Font BASE_FONT = new Font(getBaseFont());
    public static final Font H1 = new Font(getBaseFont(), 18);
    public static final Font H2 = new Font(getBaseFont(), 14, Font.BOLD);

    /**
     * Vrati zakladni font systemu.
     * @return 
     */
    public static BaseFont getBaseFont() {
        BaseFont bf = null;
        try {
            bf = BaseFont.createFont("/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-L.ttf",
                    BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
        } catch (DocumentException ex) {
            Logger.getLogger(ItextStandard.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(ItextStandard.class.getName()).log(Level.SEVERE, null, ex);
        }
        return bf;
    }
}
